package com.twu.biblioteca.command;

import com.twu.biblioteca.db.BookStore;
import com.twu.biblioteca.utilities.ConsoleReader;
import com.twu.biblioteca.utilities.MessagePrinter;

public class ReturnBookCommand implements Command {
    BookStore bookStore;
    ConsoleReader reader;
    MessagePrinter printer;

    public ReturnBookCommand(BookStore bookStore, ConsoleReader reader, MessagePrinter printer) {
        this.bookStore = bookStore;
        this.reader = reader;
        this.printer = printer;
    }

    @Override
    public void execute() {
        if(bookStore.returnBook(reader.readIdFromConsole("Book")))
            printer.printSuccessReturnMessage("Book");
        else
            printer.printErrorReturnMessage("Book");
    }
}
